home *** CD-ROM | disk | FTP | other *** search
- package hhapplet;
-
- import java.applet.Applet;
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.Frame;
- import java.awt.Label;
- import java.awt.List;
- import java.awt.Panel;
- import java.awt.Point;
- import java.awt.Toolkit;
- import java.net.MalformedURLException;
- import java.util.Vector;
-
- public class IndexSecondaryDialog extends Frame {
- protected Button m_btnDisplay = new Button("Display");
- protected Button m_btnCancel = new Button("Cancel");
- protected List m_list = new List();
- protected Applet m_applet;
- protected Vector m_vEntries;
- protected DialogDoneTarget m_ddtDone;
- private boolean m_bIsIE3 = false;
- private Point m_pntPosition;
-
- public boolean gotFocus(Event var1, Object var2) {
- if (var1.target == this) {
- this.m_list.requestFocus();
- return true;
- } else {
- return super.gotFocus(var1, var2);
- }
- }
-
- public IndexSecondaryDialog(Applet var1, Vector var2, DialogDoneTarget var3) {
- super("Topics Found");
- this.m_applet = var1;
- this.m_vEntries = var2;
- this.m_ddtDone = var3;
- if (System.getProperty("java.vendor").startsWith("Microsoft") && System.getProperty("java.version").startsWith("1.0")) {
- this.m_bIsIE3 = true;
- }
-
- int var4 = WebHelp.GetFontSize();
- this.m_list.setFont(new Font(WebHelp.GetFontName(), 0, var4));
-
- for(int var5 = 0; var5 < this.m_vEntries.size(); ++var5) {
- this.m_list.addItem(((IndexSecondaryEntry)this.m_vEntries.elementAt(var5)).name);
- }
-
- this.m_list.select(0);
- Panel var11 = new Panel();
- ((Container)var11).add(this.m_btnDisplay);
- ((Container)var11).add(this.m_btnCancel);
- ((Container)this).setLayout(new BorderLayout(5, 5));
- this.m_list.setBackground(Color.white);
- ((Component)this).setBackground(new Color(192, 192, 192));
- short var6 = 300;
- short var7 = 240;
- ((Component)this).resize(var6, var7);
- ((Container)this).add("North", new Label(" Click a topic, then click Display."));
- ((Container)this).add("Center", this.m_list);
- ((Container)this).add("South", var11);
- Dimension var8 = Toolkit.getDefaultToolkit().getScreenSize();
- int var9 = var8.width / 2 - var6 / 2;
- int var10 = var8.height / 2 - var7 / 2;
- this.m_pntPosition = new Point(var9, var10);
- ((Component)this).move(var9, var10);
- ((Frame)this).setResizable(false);
- }
-
- public List getList() {
- return this.m_list;
- }
-
- protected void gotoSelectedIndex() {
- int var1 = this.m_list.getSelectedIndex();
- if (var1 != -1) {
- try {
- IndexSecondaryEntry var2 = (IndexSecondaryEntry)this.m_vEntries.elementAt(var1);
- if (var2.frame != null) {
- this.m_applet.getAppletContext().showDocument(URLFileHandler.makeURL(this.m_applet.getDocumentBase(), var2.local, var2.url), var2.frame);
- } else {
- this.m_applet.getAppletContext().showDocument(URLFileHandler.makeURL(this.m_applet.getDocumentBase(), var2.local, var2.url), "_self");
- }
- } catch (MalformedURLException var3) {
- }
-
- this.closeDialog();
- ((Frame)this).dispose();
- }
-
- }
-
- public void show() {
- if (this.m_bIsIE3) {
- Dimension var1 = ((Component)this).size();
- ((Component)this).reshape(this.m_pntPosition.x, this.m_pntPosition.y, var1.width, var1.height);
- super.show();
- ((Component)this).reshape(this.m_pntPosition.x, this.m_pntPosition.y, var1.width, var1.height);
- } else {
- super.show();
- }
-
- this.m_list.requestFocus();
- }
-
- public boolean action(Event var1, Object var2) {
- if (var1.target != this.m_btnDisplay && var1.target != this.m_list) {
- if (var1.target == this.m_btnCancel) {
- this.closeDialog();
- return true;
- } else {
- return false;
- }
- } else {
- this.gotoSelectedIndex();
- return true;
- }
- }
-
- protected void closeDialog() {
- ((Frame)this).dispose();
- if (this.m_ddtDone != null) {
- this.m_ddtDone.dialogDone();
- }
-
- }
-
- public boolean handleEvent(Event var1) {
- if (!System.getProperty("java.version").startsWith("1.1.5") || !System.getProperty("java.vendor").startsWith("Netscape") || var1.id != 401 || var1.key != 10 || var1.target != this.m_btnDisplay && var1.target != this.m_btnCancel) {
- if (var1.id == 201) {
- this.closeDialog();
- ((Frame)this).dispose();
- } else {
- if (var1.target == this.m_list && var1.key == 10 && var1.id == 401) {
- this.gotoSelectedIndex();
- return true;
- }
-
- if (var1.target == this.m_list && var1.key == 10 && var1.id == 402) {
- if (System.getProperty("java.version").equals("1.1") && System.getProperty("java.vendor").startsWith("Microsoft")) {
- this.gotoSelectedIndex();
- return true;
- }
- } else if (var1.key == 27 && var1.id == 402) {
- this.closeDialog();
- ((Frame)this).dispose();
- }
- }
-
- return super.handleEvent(var1);
- } else {
- this.action(var1, var1.target);
- return true;
- }
- }
- }
-